﻿#region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    /// <summary>
    /// Class used as guid based enumeration list that holds the possible types for Branch Status (implemented with the Guid's hardcoded as properties to enable the text to change, but Guid's must remain or code change is necessary!!!)
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.BusinessLogic.DataAccess.LinqSProcBranchStatusTypeFactory, DataAccess")]
    public class BranchStatusTypeList : MarketPulseNameValueListBase<Guid, string>
    {
        #region Member Variables

            /// <summary>
            /// List to hold all the possible BranchStatus types
            /// </summary>
            private static BranchStatusTypeList mBranchStatusTypes;

        #endregion

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// via only the static factory methods provided.
            /// </summary>
            private BranchStatusTypeList()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method used to get a list of name/value pairs representing BranchStatusTypes 
                /// from the database.  Internally this accesses a static field so this
                /// class is effectively a lazily instantiated singleton.
                /// </summary>
                public static void GetList(EventHandler<DataPortalResult<BranchStatusTypeList>> callback)
                {

                    if (mBranchStatusTypes == null)
                    {
                        DataPortal.BeginFetch<BranchStatusTypeList>((o, e) =>
                        {
                            mBranchStatusTypes = e.Object;
                            callback(o, e);
                        });
                    }
                    else
                    {
                        callback(null, new DataPortalResult<BranchStatusTypeList>(mBranchStatusTypes, null, null));
                    }
                }

                /// <summary>
                /// Method used to get a list of name/value pairs representing BranchAttributeTypes 
                /// from the database.  Internally this accesses a static field so this
                /// class is effectively a lazily instantiated singleton.
                /// </summary>
                public static void GetList()
                {
                    // Load the list if it's null
                    if (mBranchStatusTypes == null)
                    {
                        mBranchStatusTypes = DataPortal.Fetch<BranchStatusTypeList>();
                    }
                }

            #endregion

        #endregion

        #region Properties

        #endregion

    }
}
